<template>
	<view class="captain">
		<view class="captaing">
			<view style="height: 50%;border-bottom: 1px solid #F5F5F5;">
				<view style="display: flex;align-items: center;height: 50%;">
					<text style="color: #FE0700;margin: 0  5px  0  20px;">*</text>
					<text style="color: #000000;">车队长姓名</text>
				</view>
				<input type="text" placeholder="请输入车队长姓名" style="height: 50px;margin-left: 34px;" v-model="name" />
			</view>
			<view style="height: 50%">
				<view style="display: flex;align-items: center;height: 50%;">
					<text style="color: #FE0700;margin: 0  5px  0  20px;">*</text>
					<text style="color: #000000;">车队长账号</text>
				</view>
				<input type="text" placeholder="请输入车队长账号" style="height: 50px;margin-left: 34px;" v-model="phone" />
			</view>
		</view>
		<view style="width: 100%;margin-top: 20px;margin-left: 50px;color:#FE0700;font-size: 14px;"><text>注：车队长默认登录密码123456</text></view>
		<button @click="newcaotas">新增车队长</button>
	</view>
</template>

<script>
import { ajax } from '../../api.js';
	import {HZajax} from "../../HZapi.js"
export default {
	data() {
		return {
			name: '',
			phone: ''
		};
	},
	methods: {
		newcaotas() {
			HZajax({
				url: '/v1/manager/add',
				method: 'post',
				data: {
					nickname: this.name,
					account: this.phone,
					password: '123456'
				},
				success(res) {
					console.log(res);
					if (res.data.status == 'OK') {
						uni.navigateBack({
							delta: 1
						});
					} else {
						uni.showToast({
							title: res.data.message, // 标题
							icon: 'none'
						});
					}
				}
			});
		}
	}
};
</script>

<style>
.captain {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	background-color: #f5f5f5;
}
.captaing {
	width: 355px;
	height: 215px;
	background: rgba(255, 255, 255, 1);
	border-radius: 8px;
	margin-top: 10px;
	font-size: 16px;
}
button {
	width: 355px;
	height: 44px;
	background: rgba(4, 42, 88, 1);
	border-radius: 8px;
	color: #ffffff;
	position: fixed;
	bottom: 10px;
}
</style>
